<template>
	<view class="electric">
		<view class="main">
			<view class="electric-border">
				<view class="electric-innner-border">
					<view :style="{width: power + '%'}" class="electric-body"></view>
				</view>
			</view>
			<view class="electric-right"></view>
		</view>
		<view class="info">
			<text class="num">{{power}}<text class="character">%</text></text>
			<text class="label">目前电量</text>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			power: { type: Number, default: 0 }
		}
	}
</script>

<style scoped lang="scss">
	.electric {
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: 30rpx 0 20rpx;
	}
	.main {
		display: flex;
		align-items: center;
		
		.electric-border{
			width: 340rpx;
			height: 170rpx;
			padding: 6rpx;
			border: 1rpx solid #0B71E9;
			border-radius: 12rpx;
			
			.electric-innner-border{
				width: 100%;
				height: 100%;
				border-radius: 10rpx;
				overflow: hidden;
			}
			.electric-body {
				height: 100%;
				background-image: linear-gradient(to right, #4477BC, #00B4E1);
			}
		}
		.electric-right {
			width: 20rpx;
			height: 50rpx;
			margin-left: 10rpx;
			background: #4F75BE;
			border-radius: 8rpx;
		}
	}
	.info {
		display: flex;
		align-items: center;
		flex-direction: column;
		margin-top: 20rpx;
		
		.num {
			font-size: 40rpx;
			color: #5177BF;
			
			.character {
				font-size: 28rpx;
			}
		}
		.label{
			margin-top: 8px;
			font-size: 28rpx;
			color: #999;
		}
	}
</style>
